autowatch=1;
function add(type, pname, ptitle, r, g, b, a){
    var p=this.patcher.parentpatcher;
    var b=this.patcher.box;
    if(p){
        if(type=="view"){
            var bp=p.newdefault(0,0,"bpatcher");
            bp.message("presentation",1);
            bp.message("args",'#1',pname, ptitle);
            if(r && g && b){
                if(!a)a=1;
                bp.sendbox("bgmode",2);
                bp.sendbox("bgcolor",r,g,b,a);
            }
            bp.message("patching_rect",b[0],b[1],50,50);
            bp.message("presentation_rect",b[0],b[1],50,50);
            bp.message("name","ViewWrapper.maxpat");
        }
          if(type=="model" || type=="controller" ){
            var bp=p.newdefault(0,0,pname,'#1');
            bp.sendbox("varname", ptitle);
        }
    }
}

function test(pname){
 var bp=patcher.newobject("bpatcher");
     
        bp.sendbox("presentation",1);
        bp.sendbox("args","#1");
       bp.sendbox("name",pname);
}